<template>
  <div>
    <List
      v-if="activate === 'list'"
      @switch="(payroll: SalarySheetResItem) => switchPage('detail', payroll)"
    ></List>
    <Detail
      v-if="activate === 'detail'"
      :payroll-info="payrollInfo"
      @switch="() => switchPage('list')"
    ></Detail>
  </div>
</template>

<script lang="ts" setup>
import List from './list.vue'
import Detail from './detail.vue'
import { SalarySheetResItem } from '@renderer/api/salarySheet'
const activate = ref('list')
const payrollInfo = ref<SalarySheetResItem>()
function switchPage(pageType: string, payroll?: SalarySheetResItem) {
  activate.value = pageType
  payrollInfo.value = payroll
}
</script>
<style scoped></style>
